Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
@amap/amap-jsapi-loader
Advanced tools
amap-jsapi-loader 是高德开放平台官网提供的地图 JSAPI 的加载器,可帮助开发者快速定位、有效避免加载引用地图 JSAPI 各种错误用法。
该加载器具有以下特性:
AMapLoader.load({
"key": "", // 申请好的Web端开发者Key,首次调用 load 时必填
"version": "2.0", // 指定要加载的 JSAPI 的版本,缺省时默认为 1.4.15
"plugins": [] // 需要使用的的插件列表,如比例尺'AMap.Scale'等
"AMapUI": { // 是否加载 AMapUI,缺省不加载
"version": '1.1', // AMapUI 缺省 1.1
"plugins":[], // 需要加载的 AMapUI ui插件
},
"Loca":{ // 是否加载 Loca, 缺省不加载
"version": '1.3.2' // Loca 版本,缺省 1.3.2
},
}).then(()=>{
window.AMap.xx;
window.AMapUI.xx;
window.Loca.xx
});
AMapUI 用法和官网有一点点区别。通过 AMapUI.xx 来获取组件
AMapLoader.load({
key: '',//首次load必填
version: '2.0',
AMapUI: {
version: '1.1',
plugins: ['overlay/SimpleMarker'],
}
}).then((AMap) => {
map = new AMap.Map('container');
// !!! 通过 AMap.SimpleMarker 获取组件
new AMapUI.SimpleMarker({
//前景文字
iconLabel: 'A',
//图标主题
iconTheme: 'default',
//背景图标样式
iconStyle: 'red',
map: map,
position: map.getCenter()
});
}).catch((e) => {
console.error(e);
});
尚未发布在线Loader,可将 dist/index.js 复制到项目下
<script src="../dist/index.js"></script>
<script>
AMapLoader.load({
key:'',//首次load必填
version:'2.0',
plugins:['AMap.Scale']
}).then((AMap)=>{
map = new AMap.Map('container');
map.addControl(new AMap.Scale())
}).catch((e)=>{
console.error(e);
});
</script>
安装
tnpm i @alife/amap-jsapi-loader --save-dev
使用
import AMapLoader from '@alife/amap-jsapi-loader';
AMapLoader.load().then((AMap)=>{
map = new AMap.Map('container');
}).catch(e=>{
console.log(e);
})
FAQs
高德官网提供的地图JSAPI加载器,可以避免多种异步加载API的错误用法
The npm package @amap/amap-jsapi-loader receives a total of 39,804 weekly downloads. As such, @amap/amap-jsapi-loader popularity was classified as popular.
We found that @amap/amap-jsapi-loader demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 4 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.